<?php
@ session_start();
include_once("class.lib/aa_partenaire.class.php");
include_once("class.lib/grade.class.php");
$id_coconcepteur=$_POST['id_coconcepteur'];


if(isset($_GET['id_ue'])){
	$code_ue=$_GET['id_ue'];
}else{
	$code_ue=$_SESSION['code'];
}

$id_ue=$code_ue;

$aa_partenaire=new aa_partenaire();
$aa_partenaire->SELECT(" AND id_coconcepteur='$id_coconcepteur'");
$aa_partenaire->fetch_object();

?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<script>

function updatepartenaire(){
	$.ajax(
		{
			type:"POST",
			url: "partenaire.update.action.php",  
			data: "nom="+$("input[name=nom]").val()+"&prenom="+$("input[name=prenom]").val()+"&email="+$("input[name=email]").val()+"&grade="+$("input[name=grade]").val()+"&specialite="+$("input[name=specialite]").val()+"&id_ue=<?php $code_ue;?>"
			+"&WebSite="+$("input[name=WebSite]").val()+
			"&Adresse="+$("input[name=Adresse]").val()+
			"&Ville="+$("input[name=Ville]").val()+
			"&CodePostal="+$("input[name=CodePostal]").val()+
			"&NumMobile="+$("input[name=NumMobile]").val()+
			"&WebSite="+$("input[name=WebSite]").val()+
			"&NumFax="+$("input[name=NumFax]").val()+
			
			"&tel="+$("input[name=tel]").val()+
			"&id_coconcepteur=<?php echo $id_coconcepteur;?>",
			beforeSend: function(xhr){
                $("#message").html("<img src='../images/loading_16X16.gif'/>");
            },
			success : function (data) {
				$("#ajout").html("");
				
				//alert('<? echo $code_ue; ?>');
				load_page('listpartenaire.php?id_ue=<? echo $code_ue; ?>','listcoconcepteur');
			}
		}
	);
}
</script>
<form id="addcoconcepteur" action="">

<table>


<tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
                  Le partenaire du projet est  :</strong></td>
</tr>
			

<tr>
<td></td><td><input name="specialite" value="<?php echo $aa_partenaire->get_specialite(); ?>"></td>
</tr>


 <tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
                   Le repr&eacute;sentant l&eacute;gal :</strong></td>
 </tr>
				
<tr>
<td>Nom</td><td><input name="nom" value="<?php echo $aa_partenaire->get_nom(); ?>"></td>
</tr>

<tr>
<td>Pr&eacute;nom</td><td><input name="prenom" value="<?php echo $aa_partenaire->get_prenom(); ?>"></td>
</tr>

<tr>
<td>Fonction</td><td>

<input name="grade" id="grade" value="<?php echo $aa_partenaire->get_grade(); ?>">
	<!--<select name="grade" id="grade" maxlength="50">
					<option value="">Choisissez votre grade</option>
					<?php 
		          $grade = new Grade();
                  $g=$grade->getAllGrade();
				  // Liste des grades
                 while (list($clef,$valeur)=each($g)) 
				     {  if($valeur[0]<10) $valeur[0]="0".$valeur[0];
					 if($valeur[0]==$aa_partenaire->get_grade()){
					 	echo "<OPTION value=".$valeur[0]." SELECTED>$valeur[2]</OPTION>";
					 }else{
					 	echo "<OPTION value=".$valeur[0].">$valeur[2]</OPTION>";
					 }
						
                     }
		        ?>
	</select>
	-->
</td>
</tr>

 <tr align="left"> 
                  <td colspan="3"> <strong><img src="images/navi_arerow.gif" width="6" height="21" align="absmiddle" /> 
Coordonn&eacute;es :</strong></td>
                </tr>

<tr>
<td>Adresse :</td><td><input class="validate[required,custom[telephone]] text-input"  name="Adresse" value="<?php echo $aa_partenaire->get_Adresse(); ?>"></td>
</tr>
<tr>
<td>Code postal :</td><td><input class="validate[required] text-input"  name="CodePostal" value="<?php echo $aa_partenaire->get_CodePostal(); ?>"></td>
</tr>

<tr>
<td>Ville :</td><td><input class="validate[required] text-input"  name="Ville" value="<?php echo $aa_partenaire->get_Ville(); ?>"></td>
</tr>



<tr>
<td>Tel.</td><td><input name="tel" value="<?php echo $aa_partenaire->get_tel(); ?>"></td>
</tr>

<tr>
<td>GSM :</td><td><input name="NumMobile" class="validate[required,custom[telephone]] text-input" value="<?php echo $aa_partenaire->get_NumMobile(); ?>"></td>
</tr>
			
<tr>
<td>Fax :</td><td><input name="NumFax" class="validate[required,custom[telephone]] text-input" value="<?php echo $aa_partenaire->get_NumFax(); ?>"></td>
</tr>
			
<tr>
<td>Email</td><td><input name="email" value="<?php echo $aa_partenaire->get_email(); ?>" ></td>
</tr>

<tr>
<td>Site Web</td><td><input name="WebSite" class="validate[required,custom[url]] text-input" value="<?php echo $aa_partenaire->get_WebSite(); ?>"></td>
</tr>





<tr>
<td><input type="button" value="Enregistrer" class="button" onclick="updatepartenaire();"></td><td><input type="button" value="Annuler" onclick="reset_page('modif_<?php echo $id_coconcepteur;?>');" class="button"></td>
</tr>

</table>



</form>